<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/common.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/aui-slide.css" />
    <style>
        body {
            margin: 0;
            background-color: #f5f5f5;
        }

        #header_top {
            background: #fff;
        }

        #header_top .aui-icon-left,
        #header_top .aui-title,
        #header_top .aui-icon-search,
        #header_top .aui-pull-right .aui-iconfont {
            color: #333;
        }

        .con_top {
            font-size: 0.6rem;
            color: #999;
            padding: 0.25rem 0.75rem;
        }
        .aui-list,.aui-list .aui-list-item {
          background-size: 0px;
        }
        #app ul li {
          border-top: 0.5rem solid #f5f5f5;
        }
        .fason {
          padding: 0 0.75rem;
          color: #f23030;
        }
        .head_top {
          text-align: center;
          background-color: #fff;
          padding: 1rem 0;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav" id="header_top">
        <a class="aui-pull-left aui-btn" onclick="goback()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">验证手机号</div>
    </header>
    <div id="app" v-cloak>
      <div class="head_top">
        <p>本次操作需要手机号验证，请输入</p>
        <p><span>{{phone | tel_phone}}</span>号码所收到的验证码</p>
      </div>
        <ul class="aui-list aui-form-list">
            <li class="aui-list-item">
              <div class="aui-list-item-inner" style="border-bottom: 1px solid #eee;">
                  <div class="aui-list-item-label">
                      验证码
                  </div>
                  <div class="aui-list-item-input">
                      <input type="text" placeholder="请输入验证码" style="border-right: 1px solid #eee;" v-model="code">
                  </div>
                  <div class="aui-list-item-label-icon" style="width: 8rem;" @click="isCard()">
                      <div style="color:#f23030;">重新发送</div>
                  </div>
              </div>
            </li>
        </ul>
        <button type="button" name="button" class="user_set_btn" @click="add_Card()" style="border-radius:1rem;">绑定银行卡</button>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/zepto.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript" src="../../script/utils.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<script type="text/javascript" src="../../script/aui-slide.js"></script>
<script type="text/javascript">
    function goback() {
        api.closeWin()
    }
    apiready = function() {

        var app = new Vue({
            el: '#app',
            data: {
                token: '', // 当前页
                phone: api.pageParam.phone || '',
                name: api.pageParam.name || '',
                bank_num: api.pageParam.bank_num || '',
                code: '',
            },
            created: function() {
                var $_this = this;
                $_this.token = $api.getStorage('token');
                $_this.isCard()
                console.log($_this.bank_num);
            },
            methods: {
                isCard:function() {
                  var $_this = this;
                  api.ajax({
                      url: window.Url.Freeuser_getMessage,
                      method: 'post',
                      data: {
                          values: {
                              code: 'UNOHACHA',
                              mobile: Base64.encode('UNO'+$_this.phone+'HACHA'),
                              type: 8
                          }
                      }
                  }, function(ret, err) {
                        api.toast({
                            msg: JSON.stringify(ret.info),
                            duration: 1000,
                            location: 'bottom'
                        });
                  });
                },
                add_Card:function() {
                  var $_this = this;
                  api.ajax({
                      url: window.Url.Freeucenter_addBank,
                      method: 'post',
                      data: {
                          values: {
                              token: $_this.token,
                              name: $_this.name,
                              bank_num: $_this.bank_num,
                              mobile: Base64.encode('UNO'+$_this.phone+'HACHA'),
                              code: $_this.code
                          }
                      }
                  }, function(ret, err) {
                    api.toast({
                        msg: JSON.stringify(ret.info),
                        duration: 1000,
                        location: 'bottom'
                    });
                    if(ret.re == 1) {
                      setTimeout(function() {
                        api.execScript({
                            name: 'bankCard',
                            frameName: 'bankCard',
                            script: 'window.location.reload();'
                        });
                        api.closeWin({name: 'addCard'});
                        api.closeWin({name: 'bd_Card'});
                        api.closeWin({name: 'yz_Card'})
                      },1000)
                    }
                  });
                }
            },
            filters: {
              tel_phone:function(val) {
                var phone_q3 = val.slice(0,3)
                var phone_h3 = val.slice(-3)
                return phone_q3 + "*****" + phone_h3
              }
            }
        })

    }
</script>

</html>
